package com.kaifamiao.io.d0923;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;

public class Demo01 {

    public static void main(String[] args) {
        try(FileInputStream fis = new FileInputStream("d://io/object.txt");
            ObjectInputStream ois = new ObjectInputStream(fis)){

            Object obj = ois.readObject();

            if (obj instanceof Student stu){
                System.out.println(stu);
            }

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }
}
